<template>
	<el-dialog title="" visible :show-close="false" :modal-append-to-body="false" class="wrap" size="small">
		<i class="el-icon-close close" @click="cancel" style="color: white;"></i>
		 <div class="bt">班级信息</div>
		<el-form label-width="100px" class="form">
			 <article class="settlement">
            <div>
         <div class="bjmc" style="width: 100%;margin-top: 10px;">   	
                           班级名称：<input class="aa" type="text" v-model="form.mc" style="border: none;outline: none;border-bottom: 1px solid#CCCCCC;">
                           <el-button type="info" class="submit1" style="margin: 0px 20px 0 10px;" @click="submit">修改</el-button>
         </div>    
         <div class="bjmc" style="width: 100%;margin-top: 10px;">   	
                           行政老师：<input class="aa" type="text" v-model="form.xzlsmc" style="border: none;outline: none;border-bottom: 1px solid#CCCCCC;">
                           <el-button type="info" class="submit1" style="margin: 0px 20px 0 10px;" @click="submit">修改</el-button>
         </div>
         <div class="bjmc" style="width: 100%;margin-top: 10px;">   	
                             老师名称：<input class="aa" type="text" v-model="form.lsid" style="border: none;outline: none;border-bottom: 1px solid#CCCCCC;">
                           <el-button type="info" class="submit1" style="margin: 0px 20px 0 10px;" @click="submit">修改</el-button>
         </div>
         <div class="bjmc" style="width: 100%;margin-top: 10px;">   	
                             是否启用：<input class="aa" type="text" v-model="form.isqy" style="border: none;outline: none;border-bottom: 1px solid#CCCCCC;" >
                           <el-button type="info" class="submit1" style="margin: 0px 20px 0 10px;" @click="submit">修改</el-button>
         </div>
         
                           <!--<br />
                <span class="space-between"></span>
                          行政老师：<input type="text" v-model="form.xzlsmc" style="border: none;outline: none;border-bottom: 1px solid#CCCCCC;">
                <span class="space-between"></span>
                         老师名称：<input type="text" v-model="form.lsid" style="border: none;outline: none;border-bottom: 1px solid#CCCCCC;">
                          <span class="space-between"></span>
                          是否启用：<input type="text" v-model="form.isqy" style="border: none;outline: none;border-bottom: 1px solid#CCCCCC;" >
                <span class="space-between"></span>-->
            </div>
        </article>

			<!--<el-form-item label="班级名称">
				<el-input v-model="form.mc" placeholder="请输入"  class="select-block" style="border: none; outline:nome ;"></el-input>
			</el-form-item>
			<el-form-item label="行政老师">
					<el-select v-model="form.xzlsmc" placeholder="请选择行政老师" class="select-block" >
						<el-option :label="v.xslsmc" :value="v.xzlsid+''" v-for="v in xzlsList"></el-option>
					</el-select>
			</el-form-item>
			<el-form-item label="老师名称">
				<el-select v-model="form.lsid" class="select-block">
					<el-option :label="v.mc" :value="v.id" v-for="v in comboxlist"></el-option>
				</el-select>
			</el-form-item>

			<!--<el-form-item label="册名称">
 				<el-input v-model="form.cmc"  placeholder="请输入" class="select-block"></el-input>
 			</el-form-item>
 			<el-form-item label="教材名称">
 				<el-input v-model="form.jcmc"  placeholder="请输入" class="select-block"></el-input>
 			</el-form-item>-->
			<!--<el-form-item label="是否启用">
			<el-select v-model="form.isqy"   class="select-block" >
  					  <el-option label="启用" value="Y"></el-option>
  					<el-option label="禁用" value="N" ></el-option>
  			</el-select>
  			</el-form-item>-->
  			<div class="gn">
  				<i class="el-icon-setting" style="float: left;font-size:20px;margin-right: 10px;"></i>
  				<div class="gnmc" style="float: left;">功能按钮</div>
  				<br />
  				<hr/>
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 0;" @click="submit">班级升级</el-button> 
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 0" @click="submit">换老师</el-button>
  				<router-link to="/educa/kscj">
  				<el-button type="info" class="submit"style="margin-left: 0px;" @click="submit">考试成绩</el-button>
  				</router-link>
  				<br/>
  				<router-link to="/educa/workcj">
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 50px" @click="submit">作业分数</el-button>
  				</router-link>
  				<router-link to="/educa/tingshuozy">
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 0px" @click="submit">听说检查</el-button>
  				</router-link>
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 0px" @click="submit">发音分析</el-button>
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 0px;" @click="submit">班级通知</el-button>
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 50px" @click="submit">添加学生</el-button>
  				<router-link to="/educa/check">
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 0px;" @click="submit">考勤</el-button> 
  				</router-link>
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 0px;" @click="submit">班级课表</el-button>
  				<el-button type="info" class="submit"style="margin: 10px 20px 0 0px;" @click="submit">补课</el-button> 
  			</div>
		</el-form>
		<!--<el-card> 
          <div slot="header" >
            <span></span>
            <el-button style="float: right; padding: 3px 0" type="text" @click="componentsShow('info',v)">班级详情</el-button>
          </div>
            <div class="text item">行政老师：{{v.xzlsmc}}</div>
            <div class="text item">老师名称：{{v.lsmc}}</div>
            <div class="text item">是否启用：{{v.isqymc}}</div>
            <div class="text item">学生人数：{{v.xs}}</div>
            <div class="text item">开班日期：{{v.kbrq}}</div>
              <el-button style="margin-left:50px " @click="componentsShow('sj',v)"  type="text">升级</el-button>
              <el-button style="margin-left:30px " @click="componentsShow('hls',v)"  type="text">换老师</el-button>
              <el-button style="margin-left:30px" @click="componentsShow('student',v)" type="text">班级学生</el-button>
              <el-button style="margin-left:30px" @click="componentsShow('singleDelete',v)" type="text">删除</el-button>
            <!-- </template> -->
     <!--   </el-card>-->
     
		
		
		
	</el-dialog>
</template>
<script type="text/javascript">
	import qs from 'qs'
	export default {
		props: ['params'],
		data() {
			return {
				form: {
					mc: '',
					lsmc: '',
					lsid:'',
					cmc: '',
					jcmc: '',
					isqy: '',
					fxkcid: '',
					id: '',
					xzls:'',
				},
				xzlsList: [],
				comboxlist: []
			}
		},
		created() {
			this.form.id = this.params.row.id;
			this.getcomboxlist();
			this.loadinfo();
			this.getxzlsList();
			console.log(this.form)
		},
		methods: {
			getxzlsList () {
				var logininfo = JSON.parse(localStorage.logininfo);
					this.axios.get( this.$store.state.api + 'ls/xzxzls', {
							params: {
								yhid: logininfo.id,
								xxid:logininfo.xxid
							}
					})
					.then( res => {
							console.log(res)
							this.xzlsList = res.data.data;
					}).catch( res => {
							console.log(res)
					})
			},
			getcomboxlist() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				this.axios.get(this.$store.state.api + 'ls/getlslist', {
					params: {
						yhid: logininfo.id,
						xxid: logininfo.xxid
					}
				}).then(res => {
					console.log(res)
					let data = res.data.data;
					let list = data.list;
					this.comboxlist = list;
					console.log(this.comboxlist)
				}).catch(res => {
					console.log(res)
					this.searchLoading = false;
				})
			},
			loadinfo() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.axios.get(this.$store.state.api + 'bj/info', {
					params: {
						xxid: logininfo.xxid,
						yhid: logininfo.id,
						id: this.form.id
					}
				}).then(res => {
					this.form = res.data.data
				}).catch(res => {
					this.$message.warning("服务器异常");
					this.$emit('close', { type: 'info', cancel: true });
				})
			},
			submit() {
				//检测
				this.$store.state.loading = true;
				/*if(!this.form.id) {
					this.$message.warning('请填写分类');
					this.$store.state.loading = false;
					return;
				}*/
				//装载数据
				var logininfo = JSON.parse(localStorage.logininfo);
				var params2 = qs.stringify({
					id: this.form.id,
					mc: this.form.mc,
					lsid: this.form.lsid,
					xzid:this.form.xzlsmc,
					//cid: this.form.cmc,
					//jcid: this.form.jcmc,
					isqy: this.form.isqy,
					//fxkcid: this.form.fxkcid,
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'bj/update', params2)
					.then(res => {
						if(res.data.code == 1) {
							this.$emit('close', { type: 'edit', cancel: false });
							this.$store.state.loading = false;
						} else {
							this.$emit('close', { type: 'edit', cancel: false });
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.warning("服务器异常");
						this.$store.state.loading = false;
					})
			},
			cancel() {
				this.$emit('close', { type: 'edit', cancel: true })
			}
		}
	}
</script>
<style lang="less" scoped>
	.wrap {
		text-align: center;
	}
	.bt{
		position: absolute;
		width: 100%;
		height: 50px;
		margin: 0 auto;
		top: 0;
		left: 0;
		// margin-top: -70px;
		background: #50BFFF;
		// margin-left: -20px;
		margin-bottom: 20px;
		color:white;
		text-align:left;
		line-height: 50px;
		font-size: 17px;
		padding-left: 15px;
	}
	.close{
			z-index: 10;
			position: absolute;
	}
	.form {
		text-align: left;
		margin-top: 20px;
	}

	.input {
		width: 300px;
		display: inline-block;
	}
 .space-between {
                padding:10px 0;
                display: block;
            }
	.select-block {
		width: 85%;
		display: block;
	}

	.submit {
		width: 120px;
	}
	.submit1 {
		width: 60px;
	}
	.gn{
		width: 100%;
		height: 100%;
		
	}
	.aa{
		width: 72%;
		}
</style>
